<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="avicit.platform6.core.locale.PlatformLocalesJSTL"%>
<%@page import="java.util.Locale"%>
<%@page import="avicit.platform6.api.session.SessionHelper"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="avicit.platform6.commons.utils.ViewUtil"%>
<%@ taglib prefix="sec" uri="/WEB-INF/tags/shiro.tld"%>
<%@page import="avicit.platform6.api.sysshirolog.impl.AfterLoginSessionProcess"%>
<% 
Object lang=session.getAttribute(AfterLoginSessionProcess.SESSION_CURRENT_LANGUAGE_CODE);
String languageCode="zh_CN";
if(lang!=null){
	languageCode=lang.toString();
}
	Locale locale =SessionHelper.getLocaleByUser(request);
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>导入结构数据</title>
<base href="<%=ViewUtil.getRequestPath(request)%>">
<jsp:include
	page="/avicit/platform6/component/common/EasyUIJsInclude.jsp"></jsp:include>
<jsp:include page="/avicit/im/common/ImUIJSCSSInclude.jsp"></jsp:include>
<%
	String sysId = request.getParameter("sysId");
	String tableName = request.getParameter("tableName");
	String nodeId = request.getParameter("nodeId");
	String nodeName = request.getParameter("nodeName");
	String dialogId = request.getParameter("dialogId");
	String isTrueTable = request.getParameter("isTrueTable");
%>
<script type="text/javascript"
	src="avicit/cbb/techclass/tabledefine/commtablemanager/locale/language_<%=languageCode%>.js"></script>
<link href="static/css/custom/lantop/css/custom.css" type="text/css"
	rel="stylesheet">
<script type="text/javascript">
var baseurl = "<%=ViewUtil.getRequestPath(request)%>";
var sysId = "";
var nodeId = "";
var nodeName = "";
var tableName = "";
var dialogId = "";
var isTrueTable = "";//是否为真实表 Y：真实 N：虚拟
$(function(){
	 sysId = "<%=sysId%>";
	 tableName = "<%=tableName%>";
	 nodeId = "<%=nodeId%>";
	 nodeName = "<%=nodeName%>";
	 dialogId = "<%=dialogId%>";
	 isTrueTable = "<%=isTrueTable%>";
	 
	 
	 
	
	});
	/***
	 * 导入数据
	 */
	function importData() {
		var filePath = document.getElementById("file").value;
		if (filePath == "") {
			//commonLang.tip.alert,// '提示',commonLang.tip.alert11'请选择文件！'
			$.messager.alert(commonLang.tip.alert,commonLang.tip.alert11,'warning');
		} else {
			var excelValue = filePath.substring(filePath.lastIndexOf('.'))
					.toLowerCase();
			if (excelValue == ".xlsx" || excelValue == ".xls") {
				document.getElementById("importForm").action = 'platform/aos/commtablemanagerController/importData?sysId='
						+ sysId
						+ '&tableName='
						+ tableName
						+ '&nodeId='
						+ nodeId
						+ '&nodeName='
						+ nodeName
						+ '&filePath='
						+ filePath
						+ '&dialogId='
						+ dialogId
						+ '&isTrueTable='
						+ isTrueTable;
				document.getElementById("importForm").submit();
			} else {
				//commonLang.tip.alert  '提示',commonLang.tip.alert12'请选择需要导入的Excel数据'

				$.messager.alert(commonLang.tip.alert,commonLang.tip.alert12,'warning');
			}
		}

	}
	
	function closeForm(){
		if (parent != null && parent.$('#' + dialogId) != null) {
			parent.reloadDataGrid();
			parent.$('#' + dialogId).dialog('close');
		}
	}
</script>
<style>
.file {
	position: relative;
	display: inline-block;
	border: 1px solid #dedede;
	border-radius: 4px;
	padding: 4px 12px;
	/* overflow: hidden; */
	color: black;
	text-decoration: none;
	text-indent: 0;
	line-height: 17px;
}

.file input {
	position: absolute;
	/* font-size: 100px; */
	left:0;
	top: 0;
	width:100%;
	opacity: 0;
	filter: alpha(opacity =   0) !important;
}

.file:hover {
	border-color: deepskyblue;
	text-decoration: none;
}
input[type="file" i]{

}
</style>
</head>
<body class="easyui-layout" fit="true">
	<div data-options="region:'center',split:true,border:false">
		<form id="importForm" method="post" enctype="multipart/form-data">
			<%-- Excel文件选择 --%>
			<div
				style="padding: 20px;text-align: center;">
				<a href="javascript:;" class="file">选择文件 <input type="file"
					name="file" id="file">
				</a> <span style="color: red">${requestScope.message}</span>
			</div>
		</form>
	</div>
	<div data-options="region:'south',border:false" style="height: 60px;">
		<div id="toolbar"
			class="">
			<table class="tableForm" border="0" cellspacing="1" width="100%;"
				style="padding: 10px 0;">
				<tr>
					<td align="center"><sec:accesscontrollist hasPermission="3"
							domainObject="commtempletmanager_table_node_record_set_config_btn_importButton">
							<%-- 上传 --%>
							<a id="saveButton" class="easyui-linkbutton selbtnc"
								iconCls="icon-im-publish" onclick="importData();"
								href="javascript:void(0);"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.structureDefine.table.button.importStructureData.upload","i18n.lantop",locale)%></a>
						</sec:accesscontrollist> <sec:accesscontrollist hasPermission="3"
							domainObject="commtempletmanager_table_node_record_set_config_btn_cancelButton">
							<%-- 返回 --%>
							<a id="canceButton" class="easyui-linkbutton selbtnc"
								iconCls="icon-im-back" onclick="closeForm();"
								href="javascript:void(0);"><%=PlatformLocalesJSTL.getBundleValue("lantop.basicdatamanager.libstructuredefine.structureDefine.table.button.importStructureData.return","i18n.lantop",locale)%></a>
						</sec:accesscontrollist></td>
				</tr>
			</table>
		</div>
	</div>
</body>
</html>